package com.dodock.banglapapers.server;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.dodock.banglapapers.server.generator.DDNGetNewsListGenerator;

public class DDNGetNewsList extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setContentType("application/json");
		resp.setCharacterEncoding("UTF-8");
		
		DDNGetNewsListGenerator gen = new DDNGetNewsListGenerator(req.getParameter("id"), req.getParameter("catid"));
		try {
			resp.getWriter().write(gen.Generate());
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		}
	}
	
}
